class Students:
    def __init__(self,student_id,name,age,gender,height,weight,score,address,phone_number):
        self.student_id = student_id
        self.name = name
        self.age = age
        self.gender = gender
        self.height = height
        self.weight = weight
        self.score = score
        self.address = address
        self.phone_number = phone_number
    def study(self,study_time):
        print(f"{self.name}学习了{study_time}小时")
    def play_game(self,game_name):
        print(f"{self.name}正在玩{game_name}")
    def coding(self,lines_of_code):
        print(f"{self.name}写了{lines_of_code}行代码")
    def sum_numbers(self,*args):
        return sum(args)
    def __str__(self):
        return f"学生信息：\n学号：{self.student_id}\n姓名：{self.name}\n年龄：{self.age}\n性别：{self.gender}\n身高：{self.height}\n体重：{self.weight}\n成绩：{self.score}\n家庭住址：{self.address}\n电话号码：{self.phone_number}"
if __name__ == "__main__":
    student = Students(
        student_id="20250812",
        name = "张三",
        age = 20,
        gender = "男",
        height = 175,
        weight = 70,
        score = 90,
        address = "北京市海淀区",
        phone_number = "18233702316"
    )
    print(student)
    student.study(3)
    student.play_game("英雄联盟")
    student.coding(200)
    result = student.sum_numbers(1,2,3,4,5)
    print(f"{student.name}的求和结果是：{result}")
    print("\n" + "="*50 + "\n")


class Car:
    def __init__(self, model, wheel_count, color, weight, fuel_tank_size):
        """初始化车的属性"""
        self.model = model            # 车型号
        self.wheel_count = wheel_count  # 车轮数
        self.color = color            # 车身颜色
        self.weight = weight          # 车重量（kg）
        self.fuel_tank_size = fuel_tank_size  # 油箱存储大小（L）
    def run(self, function):
        """跑的功能，传入车的具体功能"""
        print(f"{self.color}的{self.model}正在{function}")
    def __str__(self):
        """打印车的信息"""
        return f"车辆信息:\n型号: {self.model}\n车轮数: {self.wheel_count}\n颜色: {self.color}\n重量: {self.weight}kg\n油箱大小: {self.fuel_tank_size}L"
# 创建具体的车对象
ferrari = Car("法拉利", 4, "红色", 1500, 80)
bmw = Car("宝马", 4, "蓝色", 1800, 70)
suzuki = Car("铃木", 4, "白色", 1200, 50)
wuling = Car("五菱", 4, "银色", 1300, 40)
tractor = Car("拖拉机", 4, "绿色", 2000, 30)  # 拖拉机通常是4轮，但现实中可能是2轮或更多
# 测试代码
if __name__ == "__main__":
    # 打印车辆信息
    print(ferrari)
    print(bmw)
    print(suzuki)
    print(wuling)
    print(tractor)
    print("\n")
    # 调用跑的功能
    ferrari.run("赛车")
    bmw.run("城市通勤")
    suzuki.run("家用代步")
    wuling.run("拉货")
    tractor.run("耕地")
    print("\n" + "="*50 + "\n")


class Laptop:
    def __init__(self, model, standby_time, color, weight, cpu_model, ram_size, disk_size):
        """初始化笔记本属性"""
        self.model = model              # 型号
        self.standby_time = standby_time  # 待机时间（小时）
        self.color = color              # 颜色
        self.weight = weight            # 重量（kg）
        self.cpu_model = cpu_model      # CPU型号
        self.ram_size = ram_size        # 内存大小（GB）
        self.disk_size = disk_size      # 硬盘大小（GB或TB）
    def play_game(self, game_name):
        """打游戏行为，传入游戏名称"""
        print(f"{self.color}的{self.model}正在运行《{game_name}》")
    def office_work(self):
        """办公行为"""
        print(f"{self.color}的{self.model}正在办公（写文档、处理表格等）")
    def __str__(self):
        """打印笔记本信息"""
        return (
            f"笔记本信息:\n型号: {self.model}\n待机时间: {self.standby_time}小时\n"
            f"颜色: {self.color}\n重量: {self.weight}kg\nCPU型号: {self.cpu_model}\n"
            f"内存大小: {self.ram_size}GB\n硬盘大小: {self.disk_size}"
        )
# 创建具体的笔记本对象
macbook_pro = Laptop("MacBook Pro", 8, "黑色", 1.4, "M1 Pro", 16, "512GB")
legion_y7000 = Laptop("Lenovo Legion R7000p", 10, "黑色", 2.3, "i7-5800H", 16, "512GB + 1TB")
# 测试代码
if __name__ == "__main__":
    # 打印笔记本信息
    print(macbook_pro)
    print("\n")
    print(legion_y7000)
    # 调用行为方法
    print("\n")
    legion_y7000.play_game("三角洲行动")
    macbook_pro.office_work()
    print("\n" + "="*50 + "\n")


class Monkey:
    def __init__(self, species, gender, color, weight):
        """初始化猴子属性"""
        self.species = species  # 类别（如：金丝猴、猕猴）
        self.gender = gender  # 性别
        self.color = color  # 身体颜色
        self.weight = weight  # 体重（kg）
        self.learned_things = []  # 已学习的事物列表
    def make_fire(self, material):
        """造火行为，传入造火材料"""
        print(f"{self.color}的{self.species}正在用{material}造火")
    def learn_thing(self, *things):
        """学习事物，可传入多个学习内容"""
        for thing in things:
            self.learned_things.append(thing)
        learned_str = "、".join(things)
        print(f"{self.color}的{self.species}学会了：{learned_str}")
    def show_learned(self):
        """展示已学习的内容"""
        if self.learned_things:
            print(f"{self.color}的{self.species}已学会：{'、'.join(self.learned_things)}")
        else:
            print(f"{self.color}的{self.species}还没有学会任何技能")
    def __str__(self):
        """打印猴子信息"""
        return (
            f"猴子信息:\n种类: {self.species}\n性别: {self.gender}\n"
            f"颜色: {self.color}\n体重: {self.weight}kg"
        )
# 创建具体的猴子对象
golden_monkey = Monkey("金丝猴", "雄性", "金色", 15)
macaque = Monkey("猕猴", "雌性", "棕色", 8)
chimpanzee = Monkey("黑猩猩", "雄性", "黑色", 50)  # 黑猩猩也属于灵长类
# 测试代码
if __name__ == "__main__":
    # 打印猴子信息
    print(golden_monkey)
    print("\n")
    print(macaque)
    print("\n")
    print(chimpanzee)
    # 调用行为方法
    print("\n")
    golden_monkey.make_fire("木棍")
    macaque.learn_thing("使用工具", "剥香蕉")
    chimpanzee.learn_thing("使用石头", "简单算术", "手语")

    # 展示学习成果
    print()
    golden_monkey.show_learned()
    macaque.show_learned()
    chimpanzee.show_learned()